package com.uit.gis.pojo;

import com.uit.gis.util.ShapeName;
/**
 * 
 * @author ThaiBao
 *
 * Factory design pattern
 */
public class ShapeFactory {

	public static Shape getShape(ShapeName name)
	{
		  
		if(name == null)
		{
			return null;
		}
		else if(name.equals(ShapeName.LINE))
		{
			return new Line();
		}
		else if(name.equals(ShapeName.TRIANCLE))
		{
			return new Triangle();
		}
		else if(name.equals(ShapeName.RECTANGLE))
		{
			return new Rectangle();
		}
		else if (name.equals(ShapeName.ELLIPSE))
		{
			return new Ellipse();
		}
		else if (name.equals(ShapeName.POINTS))
		{
			return new Point();
		}
		else if (name.equals(ShapeName.BOX))
		{
			return new Box();
		}
		else if (name.equals(ShapeName.QUAD))
		{
			return new Quad();
		}
		else if (name.equals(ShapeName.CUSTOM_SHAPE))
		{
			return new CustomShape();
		}
		else if(name.equals(ShapeName.CIRCLE))
		{
			return new Circle();
		}
		else if(name.equals(ShapeName.ARC))
		{
			return new Arc();
		}
		return null;
	}
}
